Introduction:
In Microsoft Dynamics NAV 2018 using Extension V2 i.e Visual Studio Code(VS Code), if we want to add customized code to the standard function for e.g codeunit, we can subscribe to the standard Integration Events present near it like OnAfterEvent, but if there isn’t any standard Integration Events present near the function then we will have to create an Integration event and subscribe to it in VS Code.
This article explains how to create Integration Event and subscribe to the Event in NAV 2018 using VS Code
Pre-requisites:
- Microsoft Dynamics NAV 2018
- Visual studio Code(VS Code)
Steps:
Scenario:
Chris is a Developer and she wants to add customized code to the standard function InitGLEntry in codeunit 12 – Gen. Jnl.-Post Line. There isn’t any standard Integration Event around the function InitGLEntry. So in this case, create a new Integration Event
- Create an Integration Event: Open the Microsoft Dynamics NAV Development Environment, and in the globals create an Integration Event OnAfterInitGLEntry
2. Microsoft Dynamics NAV 2018 supports development using both C/SIDE and AL, as well as Designer side-by-side. When new objects are added or changed in C/SIDE these changes must be reflected in the symbol download in Visual Studio Code using the AL Language extension. To enable this reflection, a new command and argument has been added to finsql.exe called generatesymbolreference
2. Open Command prompt(cmd) and change the directory to the client folder to C:\Program Files (x86)\Microsoft Dynamics NAV\110\RoleTailored Client
3. Run the command
finsql.exe Command=generatesymbolreference, Database=”Demo Database NAV (11-0)”, ServerName=.\NAVDEMO`
Here, Database is the database where you wish to generate sybmol and Server Name is the SQL Server instance where the database is attached.(this will take few minutes)
4. Run the Task manager and navigate to Details tab to inspect finsql.exe
5. Check for navcommandresult.txt file in the RoleTailoredClient folder (C:\Program Files (x86)\Microsoft Dynamics NAV\110\RoleTailored Client)
6. Open Visual Studio Code(VS Code), and download symbols. use shortcut(Ctrl+shift+P)
7. Create Event subscriber in VS code
Conclusion:
To summarize, create an Integration Event in the Development Environment, run the finsql command mention above, after which download symbols and subscribe to the event.
Hi there, just became alert to your blog through Google, and found that it is truly informative.
I’m going to watch out for brussels. I will be grateful if you
continue this in future. A lot of people will
be benefited from your writing. Cheers!
LikeLike
It’s really a great and useful piece of information. I’m glad that you shared this useful information with us. Please keep us up to date like this. Thanks for sharing.
LikeLike